package chapter5;

public class ChangeableParams {
	public ChangeableParams(){}
	public void testParams(Object[] array)
	{
		for(Object o:array)
		{
			System.out.println(o.getClass().getName());
		}
	}
	
	//可以接受可变参数
	public void testChangeableParams(Object...args)
	{
		for(Object o:args)
			System.out.println(o.getClass().getName());
		if(args!=null)
			System.out.println(args.length);
	}
	
	public void testOverloadMatch(int i,Object...args)
	{
		System.out.println(i);
		for(Object o:args)
			System.out.println(o.getClass().getName());
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ChangeableParams ch=new ChangeableParams();
		//ch.testParams(new Object[]{new Integer(1),new String("String"),new Character('c')});
		ch.testChangeableParams(new Integer(1),new String("String"),new Character('c'));
		ch.testChangeableParams();
		ch.testOverloadMatch(1, new String("s"));

	}

}
